﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

namespace Hyunhdai_Saigon_Project
{
    public partial class masterpage_trangcon : System.Web.UI.MasterPage
    {
        public PagedDataSource pds = new PagedDataSource();
       
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGrid();
            }
            BindGrid();
        }
        public void BindGrid()
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["hyundaisaigonConnectionString"].ConnectionString);
            connection.Open();
            string sql = "select * from nhasanxuat where id> 1 ";
            SqlDataAdapter da = new SqlDataAdapter(sql, connection);
            DataTable dt = new DataTable();
            da.Fill(dt);
            connection.Close();
            pds.DataSource = dt.DefaultView;
            pds.AllowPaging = true;
            DLink.DataSource = pds;
            DLink.DataBind();
        }

        protected string NavigateURL()
        {
            return "Tim-Kiem.aspx?hx="+Eval("id").ToString()+"&dgx=1&dx=1";
        }
    }
}